home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / mkmf / RCS / mkmf.command,v < prev    next >
Encoding:
Text File  |  1992-10-12  |  7.5 KB  |  412 lines

  1. head     1.13;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @@;
  7.  
  8.  
  9. 1.13
  10. date     91.04.11.12.53.26;  author kupfer;  state Exp;
  11. branches ;
  12. next     1.12;
  13.  
  14. 1.12
  15. date     91.04.03.21.48.20;  author rab;  state Exp;
  16. branches ;
  17. next     1.11;
  18.  
  19. 1.11
  20. date     90.04.13.14.27.46;  author douglis;  state Exp;
  21. branches ;
  22. next     1.10;
  23.  
  24. 1.10
  25. date     89.10.09.21.28.03;  author rab;  state Exp;
  26. branches ;
  27. next     1.9;
  28.  
  29. 1.9
  30. date     89.08.18.11.21.35;  author douglis;  state Exp;
  31. branches ;
  32. next     1.8;
  33.  
  34. 1.8
  35. date     89.08.17.11.15.57;  author douglis;  state Exp;
  36. branches ;
  37. next     1.7;
  38.  
  39. 1.7
  40. date     89.04.06.21.40.17;  author jhh;  state Exp;
  41. branches ;
  42. next     1.6;
  43.  
  44. 1.6
  45. date     89.01.16.08.23.29;  author ouster;  state Exp;
  46. branches ;
  47. next     1.5;
  48.  
  49. 1.5
  50. date     88.12.31.10.43.50;  author ouster;  state Exp;
  51. branches ;
  52. next     1.4;
  53.  
  54. 1.4
  55. date     88.12.28.14.45.46;  author ouster;  state Exp;
  56. branches ;
  57. next     1.3;
  58.  
  59. 1.3
  60. date     88.11.13.11.50.19;  author ouster;  state Exp;
  61. branches ;
  62. next     1.2;
  63.  
  64. 1.2
  65. date     88.11.10.15.14.52;  author ouster;  state Exp;
  66. branches ;
  67. next     1.1;
  68.  
  69. 1.1
  70. date     88.11.10.14.00.41;  author ouster;  state Exp;
  71. branches ;
  72. next     ;
  73.  
  74.  
  75. desc
  76. @@
  77.  
  78.  
  79. 1.13
  80. log
  81. @Flush DEFTARGET: the default target is now determined by a pmake
  82. library file.
  83. @
  84. text
  85. @#!/sprite/cmds/csh -f
  86. #
  87. # A script to generate (or regenerate) a source (cmds) directory  Makefile
  88. # from a prototype Makefile.  If ./Makefile.proto exists, use it, else
  89. # use a common prototype.
  90. #
  91. # We assume we were invoked from mkmf, thus we don't need to alter the
  92. # path, and MKMFDIR is in the environment to tell us where to find prototype
  93. # makefiles, etc.
  94. #
  95. # Parameters passed in from mkmf as environment variables:
  96. #
  97. #    DOMACHINES    names of machines we are supposed to run mkmf on
  98. #    MKMFDIR        directory containing prototype makefiles
  99. #    MKMFFLAGS    arguments to all mkmfs run recursively
  100. #    MACHINES    list of machine names (e.g. "sun2 sun3"), for
  101. #            which there are machine-dependent subdirectories
  102. #            (sun2.md, sun3.md) to hold the object files and
  103. #            any machine-specific source files to use when
  104. #            compiling for that machine
  105. #    MAKEFILE    name of makefile to create
  106. #    SUBTYPE        information about what type of command this is:
  107. #            used to figure out where to install things.
  108. #
  109. # Several of these environment variables must be copied to local shell
  110. # variables before use, because shell variables can be used in some places
  111. # where environment variables can't.
  112.  
  113. #
  114. # Argument processing.  (Generalized form, even though just one flag so far.)
  115. #
  116. while ($#argv >= 1)
  117.     if ("$1" == '-x') then
  118.     set echo
  119.     endif
  120.     shift
  121. end
  122.  
  123. set nonomatch
  124. set srcs =(*.{h,c,s,l,y,cc} *.md/*.{h,c,s,l,y,cc,o})
  125. set mds = (*.md)
  126. set manPages = (*.man)
  127. if ("$mds" == "*.md") then
  128.     set mds = ()
  129. endif
  130. if ("$manPages" == "*.man") then
  131.     set manPages = ()
  132. endif
  133. #
  134. # Check to see if there were any sources.  The first check (size == 2, the
  135. # number of strings that would be there if there were no matches)
  136. # is only necessary because the second check will cause an error if
  137. # srcs contains more than 1024 bytes.  If no sources, then assume that
  138. # this directory contains only a shell script (and eliminate any
  139. # machine-dependent subdirectories that Pmake might have created).
  140. #
  141. if ($#srcs == 2) then
  142.     if ("$srcs" == "*.{h,c,s,l,y,cc} *.md/*.{h,c,s,l,y,cc,o}") unset srcs
  143. endif
  144. unset nonomatch
  145. if (! $?srcs) then
  146.     echo "No sources, assuming shell script."
  147.     if ("$mds" != "") then
  148.     echo "Deleting extraneous subdirectories $mds."
  149.     rmdir $mds
  150.     if ($status != 0) then
  151.         echo "Error removing directories: not empty."
  152.         exit 1
  153.     endif
  154.     endif
  155.     $MKMFDIR/mkmf.script $*
  156.     exit $status
  157. endif
  158.  
  159. set subtype=$SUBTYPE
  160. set prog=$cwd:t
  161. set machines=($MACHINES)
  162. set domachines = ($DOMACHINES)
  163. set makefile=($MAKEFILE)
  164. set distdir=($DISTDIR)
  165.  
  166. if (-e $makefile.proto) then
  167.     set proto=$makefile.proto
  168. else
  169.     set proto="${MKMFDIR}/Makefile.command"
  170. endif
  171.  
  172. echo "Generating $makefile for $prog using $proto"
  173.  
  174.  
  175. cat $proto | sed \
  176.     -e "s,@@(DATE),`date`,g" \
  177.     -e "s,@@(MACHINES),$machines,g" \
  178.     -e "s,@@(MAKEFILE),$makefile,g" \
  179.     -e "s,@@(MANPAGES),$manPages,g" \
  180.     -e "s,@@(NAME),$prog,g" \
  181.     -e "s,@@(TEMPLATE),$proto,g" \
  182.     -e "s,@@(TYPE),$subtype,g" \
  183.     -e "s,@@(DISTDIR),$distdir,g" \
  184.     > $makefile
  185.  
  186. setenv PARENTDIR $cwd
  187. foreach i ($domachines)
  188.     (cd $i.md; mkmf $MKMFFLAGS -f md.mk)
  189. end
  190. @
  191.  
  192.  
  193. 1.12
  194. log
  195. @Add C++ support (Mike checking in for Bob).
  196. @
  197. text
  198. @a12 1
  199. #    DEFTARGET    name of default target
  200. a79 1
  201. set defTarget=($DEFTARGET)
  202. a92 1
  203.     -e "s,@@(DEFTARGET),${defTarget:q},g" \
  204. @
  205.  
  206.  
  207. 1.11
  208. log
  209. @only remove subdirectories if empty.
  210. @
  211. text
  212. @d41 1
  213. a41 1
  214. set srcs =(*.[hcsly] *.md/*.[hcslyo])
  215. d59 1
  216. a59 1
  217.     if ("$srcs" == "*.[hcsly] *.md/*.[hcslyo]") unset srcs
  218. @
  219.  
  220.  
  221. 1.10
  222. log
  223. @Modifications for distribution.
  224. @
  225. text
  226. @d66 5
  227. a70 1
  228.     rm -rf $mds
  229. @
  230.  
  231.  
  232. 1.9
  233. log
  234. @another change for TM -- use single machine if it exists, else \ds3100
  235. @
  236. text
  237. @d78 1
  238. d98 1
  239. @
  240.  
  241.  
  242. 1.8
  243. log
  244. @removed DEFTARGET -- we use $MACHINE now
  245. @
  246. text
  247. @d13 1
  248. d77 1
  249. d90 1
  250. @
  251.  
  252.  
  253. 1.7
  254. log
  255. @added abilty to make specific machine types
  256. @
  257. text
  258. @a12 1
  259. #    DEFTARGET    name of default target
  260. a75 1
  261. set defTarget=($DEFTARGET)
  262. a87 1
  263.     -e "s,@@(DEFTARGET),$defTarget,g" \
  264. @
  265.  
  266.  
  267. 1.6
  268. log
  269. @Bug in last change.
  270. @
  271. text
  272. @d12 3
  273. d75 1
  274. d77 1
  275. a86 5
  276. if (" $machines " =~ *\ sun3\ *) then
  277.     set defTarget=sun3
  278. else
  279.     set defTarget=$machines[1]
  280. endif
  281. d99 2
  282. a100 1
  283. foreach i ($machines)
  284. @
  285.  
  286.  
  287. 1.5
  288. log
  289. @Include ".y" files when deciding whether there are any sources.
  290. @
  291. text
  292. @d38 1
  293. a38 1
  294. set srcs =(*.[hcsl] *.md/*.[hcslo])
  295. @
  296.  
  297.  
  298. 1.4
  299. log
  300. @Change to use TYPE instead of INSTALLMAN and INSTALLDIR.
  301. @
  302. text
  303. @d56 1
  304. a56 1
  305.     if ("$srcs" == "*.[hcsl] *.md/*.[hcslo]") unset srcs
  306. @
  307.  
  308.  
  309. 1.3
  310. log
  311. @Change "PROGRAM" to "NAME".
  312. @
  313. text
  314. @a69 25
  315. switch ($subtype)
  316.     case sprite:
  317.     set installdir=/sprite/cmds
  318.     set installman=/sprite/doc/ref/cmds
  319.     breaksw
  320.     case daemon:
  321.     set installdir=/sprite/daemons
  322.     set installman=/sprite/doc/ref/daemons
  323.     breaksw
  324.     case test:
  325.     set installdir=/sprite/tests
  326.     set installman=/sprite/doc/ref/tests
  327.     breaksw
  328.     case admin:
  329.     set installdir=/sprite/admin
  330.     set installman=/sprite/doc/ref/admin
  331.     breaksw
  332.     case x:
  333.     set installdir=/X/cmds
  334.     set installman=/X/doc/ref/cmds
  335.     breaksw
  336.     default:
  337.     echo Unknown command subtype "$subtype"
  338.     exit 1
  339. endsw
  340. a90 2
  341.     -e "s,@@(INSTALLDIR),$installdir,g" \
  342.     -e "s,@@(INSTALLMAN),$installman,g" \
  343. d95 3
  344. a97 1
  345.     -e "s,@@(TEMPLATE),$proto,g" > $makefile
  346. @
  347.  
  348.  
  349. 1.2
  350. log
  351. @Final change for new C library:  added man page stuff, etc.
  352. @
  353. text
  354. @d121 1
  355. a121 1
  356.     -e "s,@@(PROGRAM),$prog,g" \
  357. @
  358.  
  359.  
  360. 1.1
  361. log
  362. @Initial revision
  363. @
  364. text
  365. @a21 9
  366. #            
  367. # Variables generated here:
  368. #    subtype        subtype of makefile to make (e.g. att, src, local, etc.)
  369. #    prog        program to create (directories are assumed to be named
  370. #            after the programs they create)
  371. #    makefile    name of the makefile to create
  372. #    proto        name of prototype makefile to use to create $makefile
  373. #    machines    variable equivalent to MACHINES;  needed because env
  374. #            variables can't always be used where variables can.
  375. d23 3
  376. d38 9
  377. a46 1
  378. set srcs =( *.[hcsl] *.md/*.[hcsl])
  379. d51 3
  380. a53 1
  381. # srcs contains more than 1024 bytes.
  382. d56 1
  383. a56 1
  384.     if ("$srcs" == "*.[hcsl] *.md/*.[hcsl]") unset srcs
  385. d61 4
  386. a64 3
  387. # get rid of the default subdirectory mkmf creates when it thinks this is an
  388. # executable program.
  389.     if (-d sun3.md) rmdir sun3.md
  390. d73 1
  391. d77 1
  392. d81 1
  393. d85 1
  394. d89 1
  395. d97 1
  396. a97 1
  397. set makefile=$MAKEFILE
  398. d102 1
  399. a102 1
  400.     set proto="${MKMFDIR}/Makefile.command2"
  401. d114 4
  402. a117 1
  403.     -e "s,@@(PROGRAM),$prog,g" \
  404. a118 1
  405.     -e "s,@@(DEFTARGET),$defTarget,g" \
  406. d120 3
  407. a122 3
  408.     -e "s,@@(TEMPLATE),$proto,g" \
  409.     -e "s,@@(DATE),`date`,g" \
  410.     -e "s,@@(INSTALLDIR),$installdir,g" > $makefile
  411. @
  412.